problem on Bernoulli Trails